package ooday03;

public class AnimalTest {
    public static void main(String[] args) {
       Dog [] dogs = new Dog[3];
       dogs[0] = new Dog("小黑" , 2 ,"黑");
        dogs[1] = new Dog("小灰" , 1 ,"灰");
        dogs[2] = new Dog("小白" , 3 ,"白");
        System.out.println(dogs[0].name);
        dogs[1] .age = 4;
        dogs[2].swim();
        for (int i = 0; i < dogs.length; i++) {
            dogs[i].eat();
        }

        Chick [] chicks = new Chick[2];
        chicks[0] = new Chick("大白" , 2 ,"白");
        chicks[1] = new Chick("大红" , 1 ,"红");
        for (int i = 0; i < chicks.length; i++) {
            chicks[i].drink();
        }

        Fish [] fish = new Fish[3];
        fish[0] = new Fish("红鱼",1,"红");
        fish[1] = new Fish("黑鱼",2,"黑");
        fish[2] = new Fish("黄鱼",2,"黄");
        for (int i = 0; i < fish.length; i++) {
            fish[i].drink();
        }
    }
}
